package com.nbsaas.boot.common.data.entity;


import com.nbsaas.boot.code.annotation.*;
import com.nbsaas.boot.code.annotation.data.Dict;
import com.nbsaas.boot.code.annotation.data.DictItem;
import com.nbsaas.boot.code.annotation.data.DictKey;
import com.nbsaas.boot.jpa.data.entity.LongEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.Comment;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;

@ComposeView
@org.hibernate.annotations.Table(appliesTo = "bs_component", comment = "组件")
@EqualsAndHashCode
@Data
@FormAnnotation(model = "组件")
@Entity
@Table(name = "bs_component")
public class Component extends LongEntity {


    @SearchItem(label = "组件名称", name = "name")
    @Comment("组件名称")
    @FormField(title = "组件名称", grid = true, width = "200",required = true)
    @Column(length = 30)
    private String name;

    @DictKey("componentType")
    @FormField(title = "组件类型", grid = true, col = 12,type = InputType.dictionary)
    @Comment("组件类型")
    @Dict(
            items = {
                    @DictItem(value = 1, label = "系统"),
                    @DictItem(value = 2, label = "自定义")
            }
    )
    private Integer type;

    @FormField(title = "标签",width = "300",grid = true, col = 12)
    private String tag;

    @FormField(title = "组件地址", col = 12)
    @Comment("自定义组件路径")
    private String path;

    @FormField(title = "代码模板", col = 24,type = InputType.textarea)
    @Comment("代码模板")
    private String codeTemplate;


    @FormField(title = "添加时间", grid = true,width = "10000",ignore = true)
    @Comment("添加时间")
    private Date addDate;


    @Comment("最新修改时间")
    private Date lastDate;

}
